package com.rockcent.mall.lib.helper;

import com.rockcent.mall.lib.domain.MallOrderPayment;
import com.rockcent.mall.lib.domain.enumclass.PaymentMethod;
import com.rockcent.mall.lib.domain.enumclass.MallOrderPaymentStatus;

import java.math.BigDecimal;

/**
 * Created by HK on 16/11/4.
 *
 */
public class BaseMallOrderPaymentHelper {

    /**
     * 封装平台订单支付
     * @param paymentNum
     * @param amount
     * @param mallId
     * @param mallOrderId
     * @param mallOrderNum
     * @param customerId
     * @return
     */
    public MallOrderPayment create(String paymentNum,BigDecimal amount,Long mallId,Long mallOrderId,String mallOrderNum,Long customerId) {
        return this.create(paymentNum,amount,mallId,mallOrderId,mallOrderNum,customerId,null);
    }

    /**
     * 封装平台订单支付
     * @param paymentNum
     * @param amount
     * @param mallId
     * @param mallOrderId
     * @param mallOrderNum
     * @param customerId
     * @return
     */
    public MallOrderPayment create(String paymentNum,BigDecimal amount,Long mallId,Long mallOrderId,String mallOrderNum,Long customerId,MallOrderPaymentStatus status) {
        MallOrderPayment mallOrderPayment = new MallOrderPayment();
        mallOrderPayment.setPaymentNum(paymentNum);
        mallOrderPayment.setAmount(amount);
        mallOrderPayment.setMallId(mallId);
        mallOrderPayment.setMallOrderId(mallOrderId);
        mallOrderPayment.setMallOrderNum(mallOrderNum);
        mallOrderPayment.setCustomerId(customerId);
        mallOrderPayment.setPaymentMethod(PaymentMethod.WECHAT);
        mallOrderPayment.setStatus(MallOrderPaymentStatus.WAIT);
        if(status != null){
            mallOrderPayment.setStatus(status);
        }
        return mallOrderPayment;
    }
}
